package com.robinmouren.constant;

import com.baomidou.mybatisplus.core.toolkit.support.SFunction;
import com.robinmouren.entity.*;

import java.time.LocalDateTime;
import java.util.HashMap;
import java.util.Map;

public class OrderConstant {

    public static final int ORDER = 1;
    public static final int CONTRACT = 2;
    public static final int TRANSPORT = 3;

    // 订单的长度
    public static final int ORDER_LENGTH = 10;
    public static final int CONTRACT_LENGTH = 8;

    // 报价有效截止期
    // public static final LocalDateTime TIME = LocalDateTime.now().minusMinutes(-30);

    // input选项框value1
    // 订单信息
    public static final Map<String, SFunction<OrderInfo,?>> ORDER_INPUT_MAP =
            new HashMap<String, SFunction<OrderInfo,?>>(){{
        put("收货人", OrderInfo::getReceiving);
        put("始发地", OrderInfo::getOriginPlace);
        put("目的地", OrderInfo::getDestination);
        put("订单号", OrderInfo::getOrderNumber);
        put("运单号",OrderInfo::getTrackingNumber);
        put("下单时间",OrderInfo::getCreateTime);
        put("报价有效截止期",OrderInfo::getQuotationOverdue);
        put("询价有效截止期",OrderInfo::getInquiryOverdue);
        put("货名", null);
    }};
    // 订单详细信息，货物信息
    public static final Map<String, SFunction<OrderDetail,?>> ORDER_DETAIL_INPUT_MAP =
            new HashMap<String, SFunction<OrderDetail,?>>(){{
        put("货名", OrderDetail::getName);
    }};


    // 运输货物信息
    public static final Map<String, SFunction<TransportRoute,?>> TRANSPORT_ROUTE_MAP =
            new HashMap<String, SFunction<TransportRoute,?>>(){{
        put("始发地", TransportRoute::getOriginPlace);
        put("目的地", TransportRoute::getDestination);
        put("报价有效截止期", TransportRoute::getValidEndTime);
        put("下单时间", TransportRoute::getCreateTime);
    }};



    // 网点信息
    public static final Map<String, SFunction<Outlets,?>> OUTLETS_MAP =
            new HashMap<String, SFunction<Outlets,?>>(){{
                put("目的地", Outlets::getAddress);
                put("网点", Outlets::getOutlets);
            }};

    // 客户合同信息
    public static final Map<String, String> CLIENT_CONTRACT =
            new HashMap<String, String>(){{
                put("合同编号", "number");
                put("订单号",  "order_number");
                put("收货人",  "principal");
                put("始发地",  "origin_place");
                put("目的地",  "destination");
                put("货名",  "name");
            }};






    public static final Map<Integer, String> MAP = new HashMap<Integer, String>(){{
        put(OrderConstant.ORDER,"XL");
        put(OrderConstant.CONTRACT,"THDKL");
        put(OrderConstant.TRANSPORT,"SL");
    }};

    public static final Map<Integer, Integer> MAP_LENGTH = new HashMap<Integer, Integer>(){{
        put(OrderConstant.ORDER,OrderConstant.ORDER_LENGTH);
        put(OrderConstant.CONTRACT,OrderConstant.CONTRACT_LENGTH);
    }};

}
